<?php

namespace app\common\model\mall\order;

use think\Model;

class Refund extends Model
{
    // 表名
    protected $name = 'mall_order_refund';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'refundReson_text',
        'refundStatus_text'
    ];

    public function getRefundresonList()
    {
        return ['1' => __('Refundreson 1'),'2' => __('Refundreson 2'),'3' => __('Refundreson 3'),'4' => __('Refundreson 4'),'5' => __('Refundreson 5'),'6' => __('Refundreson 6'),'99' => __('Refundreson 99')];
    }     

    public function getRefundstatusList()
    {
        return ['1' => __('Refundstatus 1'),'-1' => __('Refundstatus -1')];
    }     


    public function getRefundresonTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['refundReson']) ? $data['refundReson'] : '');
        $list = $this->getRefundresonList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getRefundstatusTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['refundStatus']) ? $data['refundStatus'] : '');
        $list = $this->getRefundstatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }

}
